<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>模态框</title>
    <link rel="stylesheet" href="bootstrap.min.css"/>
</head>
<body>
    <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#mymodal" data-whatever="@ime">点击出现</button>
    <div class="modal fade bs-example-modal-lg" id="mymodal" role="dialog" aria-label="myModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title">Modal title</h4>
                </div>
                <div class="modal-body">
                    <form action="">
                        <div class="form-group">
                            <label class="control-label">userName</label>
                            <input type="text" class="form-control"/>
                        </div>
                        <div class="form-group">
                            <label class="control-label">password</label>
                            <input type="password" class="form-control"/>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        Close
                    </button>
                    <button type="button" class="btn btn-primary">
                        Save
                    </button>
                </div>
            </div>
        </div>
    </div>
    <script src="jquery-1.11.1.js"></script>
    <script src="bootstrap.min.js"></script>
    <script>
       // $("#mymodal").modal("hide");
        $("#mymodal").on("show.bs.modal",function(e){
            var button = $(e.relatedTarget);
            var recipinet = button.data("whatever");
            var modal = $(this);
            modal.find(".modal-title").text("hello" + recipinet);
            modal.find(".modal-body input").val(recipinet);
        })

//        $("#mymodal").modal({
//            backdrop:false
//        })

       $("#mymodal").on("hidden.bs.modal",function(e){
           alert("窗口被关闭");
       })
    </script>
</body>
</html>